package org.uned.agonzalo16.bitacora.web.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.uned.agonzalo16.bitacora.service.article.FeaturedArticlesService;

@Configurable
@SuppressWarnings("serial")
public class FeaturedArticlesTag extends TagSupport {

	@Autowired
	private transient FeaturedArticlesService featuredArticlesService;

	private String var;

	public void setVar(String var) {
		this.var = var;
	}

	@Override
	public int doStartTag() throws JspException {
		pageContext.setAttribute(var, featuredArticlesService.getFeaturedArticles());

		return SKIP_BODY;
	}

}
